GATE CSE 2015 SET-3


Q1.

Consider the following C program. #include < stdio.h > int main( ) { static int a[ ] = {10, 20, 30, 40, 50}; static int *p[ ] = {a, a+3, a+4, a+1, a+2}; int **ptr = p; ptr++; printf("%d%d", ptr-p,**ptr); }The output of the program is ______________.
GateOverflow

Q2.

Consider the following C program segment. #include < stdio.h > int main() { char s1[7] = "1234", *p; p = s1 + 2; *p = '0'; printf("%s", s1); } What will be printed by the program?
GateOverflow

Q3.

Consider the following two C code segments. Y and X are one and two dimensional arrays of size n and nxn respectively, where 2\leq n\leq 10. Assume that in both code segments, elements of Y are initialized to 0 and each element X[i][j] of array X is initialized to i+j. Further assume that when stored in main memory all elements of X are in same main memory page frame. Code segment 1://initialize elements of Y to 0 //initialize elements X[i][j] of X to i+j for(i = 0; i < n; i++) Y[i] += X[0][i]; Code Segment 2: //initialize elements of Y to 0 //initialize elements X[i][j] of X to i+j for(i = 0; i < n; i++) Y[i] += X[i][0]; Which of the following statements is/are correct? S1: Final contents of array Y will be same in both code segments S2: Elements of array X accessed inside the for loop shown in code segment 1 are contiguous in main memory S3: Elements of array X accessed inside the for loop shown in code segment 2 are contiguous in main memory
GateOverflow

Q4.

While inserting the elements 71, 65, 84, 69, 67, 83 in an empty binary search tree (BST) in the sequence shown, the element in the lowest level is
GateOverflow

Q5.

Consider the equality \sum_{i=0}^{n}i^{3}=X and the following choices for X I. \Theta (n^{4}) II. \Theta (n^{5}) III. O (n^{5}) IV. \Omega (n^{3}) The equality above remains correct if X is replaced by
GateOverflow

Q6.

Let f(n)=n and g(n)=n^{1+sin \; n} where n is a positive integer. Which of the following statements is/are correct? I. f(n)=O(g(n)) II. f(n)= \Omega (g(n))
GateOverflow

Q7.

Consider a machine with a byte addressable main memory of 2^{20} bytes, block size of 16 bytes and a direct mapped cache having 2^{12} cache lines. Let the addresses of two consecutive bytes in main memory be (E201F)_{16} and (E2020)_{16}. What are the tag and cache line address (in hex) for main memory address (E201F)_{16}?
GateOverflow

Q8.

If for non-zero x,af(x)+bf\left ( \frac{1}{x} \right )=\frac{1}{x}-25 where a\neq b then \int_{1}^{2}f(x)dx is
GateOverflow

Q9.

The value of \lim_{x\rightarrow \infty }(1+x^{2})^{e^{-x}} is
GateOverflow

Q10.

The number of 4 digit numbers having their digits in non-decreasing order (from left to right) constructed by using the digits belonging to the set {1, 2, 3} is____________.
GateOverflow